<template>
  <div class="cliseatex">
    <!-- <h2> 学做多</h2> -->
    <div class="title">
      <div class="top">
        <div class="back">
          <van-icon name="arrow-left" size="30px" @click="back()" />
        </div>
        <div class="search">
          <van-search
            
            @input="getValue"
            v-model="value"
            placeholder="白萝卜"
            color="white"
          />
        </div>
        <div class="text"><p>搜索</p></div>
      </div>
    </div>

    <div class="contit">
    
        
  <van-tabs  route >
  <van-tab line-width="20" color ="#ffc533"  
    v-for="(item, index) in listNavigation" :title="item.title" :key="index"
    route
     :to="{name: item.name}" @click="theIndex(index,item.name)">  </van-tab>
  
</van-tabs>
    </div>
    
    <router-view></router-view>
    

  </div>
</template>

<script>
export default {
  name: "Cliseatex",
  data(){
    return{

        listNavigation: [
        { title: "菜谱", name: "Caipu" },
        { title: "笔记", name: "Biji"},
        { title: "用户", name: "Yonghu"},
        { title: "商品", name: "Shangp"},
        { title: "课堂", name: "Ketang"},
        
      ],

        //热门的内容
        productDataact:[],
        //搜索的内容
        productSearch:[],    
        tabIndex:0,  
        value: "", 
    }
  },
  created() {
    for (let i = 0; i < this.listNavigation.length; i++) {
        if (this.$route.name === this.listNavigation[i].name) {

            this.tabIndex = i;
            break;
        }
        
    }
    // this.GetRecommend();
    // console.log(this.value);
    // this.Getsearch();
  },
  methods:{
    back() {
    //   this.$router.back();
    this.$router.push({ name:"Seatiaoz"})
    },
    getValue(){
        let va = this.value;
        console.log('这个是value',va);
    },

    theIndex(index, name) {
      if (this.tabIndex === index) {
        return;
      }
      this.tabIndex = index;

      this.$router.push({ name });
    },
  }
};
</script>

<style lang="less" scoped>
  .active{
    font-size: 25px;
    font-weight: 900;
    color: #2a2a2a;
    position: absolute;
    bottom: 0.4rem;
    left: 0;
    z-index: 1;
    width: 0.8667rem;
    height: 0.12rem;
    background-color: #ffc533;
    border-radius: 0.08rem;
  }
  :deep .van-tabs__wrap .van-tab--active {
    font-size: 16px;
    font-weight: 900;
    color: #2a2a2a;
   
}
 :deep .van-tabs__line {
    position: absolute;
    bottom: 0.4rem;
    left: 0;
    z-index: 1;
    width: 0.8667rem;
    height: 0.08rem;
    background-color: #ffc533;
    border-radius: 0.08rem;
}
//字体
:deep .van-tab__text--ellipsis {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;

}

 .cliseatex{ 
    background-color: white;
    height: 100vh;
  .title {
    padding: 20px;
    .top {
      display: flex;
      justify-content: center;
      align-items: center;
      .back {
        padding-right: 10px;
      }
      .search{
        width: 240px;
        border-radius: 10px;
      }

      .text {
        p{
        font-size: 15px;
        width: 30px;
        
        font-weight: 800;
        color: #606060;
        }
      }
     }
    }
    }
</style>
